import QtQuick 2.15
import QtQuick.Controls 2.15


/**
  * 自定义菜单项
  */
Menu {
    id: cusMenu

    property string mTitle

    property color menuBgColor: "#fff"
    property color menuBgActiveColor: "#f2f6fa"
    property color menuFontColor: "#000"
    property color menuFontActiveColor: "#000"

    title: cusMenu.mTitle

    delegate: MenuItem {
        id: mMenuItem

        contentItem: Text {
            text: mMenuItem.text
            font: mMenuItem.font
            opacity: enabled ? 1.0 : 0.3
            color: mMenuItem.highlighted ? cusMenu.menuFontActiveColor : cusMenu.menuFontColor
            horizontalAlignment: Text.AlignLeft
            verticalAlignment: Text.AlignVCenter
            elide: Text.ElideRight
        }

        background: Rectangle {
            implicitWidth: 40
            implicitHeight: 40
            opacity: enabled ? 1 : 0.3
            color: mMenuItem.highlighted ? cusMenu.menuBgActiveColor : "transparent"
        }
    }

    background: Rectangle {
        implicitWidth: 200
        implicitHeight: 40
        color: "#ffffff"
        border.color: "#21be2b"
        radius: 2
    }
}
